<template>
	<view>
		<view class="video" v-if="m3u8 != ''">
			<video :src="m3u8" controls="true"  enable-danmu danmu-btn></video>
		</view>
		<view class="text" v-else>
			此视频跑丢了，呜呜呜~~~
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				m3u8: '',
				queryObj: {
					name: '',
					classify: ''
				}
			};
		},

		onLoad(option) {
			this.queryObj.name = option.name
			this.queryObj.classify = option.classify

			this.getM3u8()
		},

		methods: {
			async getM3u8() {
				const {
					data: res
				} = await this.$myRequest({
					url: '/my/movie/playmovie',
					data: this.queryObj
				})
				this.m3u8 = res.m3u8
			}
		}
	}
</script>

<style lang="scss">
	.text {
		position: absolute;
		top: 40%;
		font-size: 26px;
		font-weight: 700;
		color: #ff770f;
		align-content: center;
		transform: translateY(-50%);
	}
	
	.video {
		video {
			width: 100%;
		}
	}
</style>
